<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审理环节-处罚情况查询</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/custom.form.css">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"></div>
                <div class="layui-card-body">
                    <form id="searchForm" class="layui-form" method="post" style="margin-left: 10px">
                        <div class="layui-form-item">
                            <div class="layui-input-inline">
                                <label for="jcajbh"></label><input type="text" id="jcajbh" class="layui-input"
                                                                   autocomplete="off"
                                                                   placeholder="请输案件编号">
                            </div>
                            <div class="layui-input-inline">
                                <label for="nsrsbh"></label><input type="text" id="nsrsbh" class="layui-input"
                                                                   autocomplete="off"
                                                                   placeholder="请输纳税人识别号">
                            </div>
                            <div class="layui-input-inline">
                                <label for="nsrmc"></label><input type="text" id="nsrmc" class="layui-input"
                                                                  autocomplete="off"
                                                                  placeholder="请输入纳税人名称">
                            </div>
                            <div class="layui-input-inline">
                                <label for="time"></label><input type="text" readonly class="layui-input" id="time"
                                                                 placeholder="日期">
                            </div>
                            <div class="layui-input-inline">
                                <label for="xhTime"></label><input type="text" readonly class="layui-input" id="xhTime"
                                                                   placeholder="销号日期">
                            </div>
                            <div class="layui-input-inline">
                                <button type="button" class="layui-btn" lay-submit="" lay-filter="search">查询</button>
                                <button type="button" class="layui-btn" lay-submit="" lay-filter="reset">重置</button>
                            </div>
                        </div>
                        <table class="layui-table" id="cljdsTable" lay-filter="cljdsTable"></table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="/layui/layui.all.js"></script>
<script src="/js/core.util.js"></script>
<script th:inline="none">
    //获取token
    let token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    let tokenQuery = token.replace("#", "%23");
    let tableIns1;
    let table = layui.table;
    let form = layui.form;
    let layer = layui.layer;
    let $ = jQuery = layui.jquery;
    let laydate = layui.laydate;
    let tree = layui.tree;
    let startTime = null;
    let endTime = null;
    let xh_startTime = null;
    let xh_endTime = null;
    layui.config({
        base: '/'
    }).use(['table', 'laypage', 'layer', 'laydate', 'form'], function () {
        // 默认科室下拉选
        tableIns1 = table.render({
            elem: '#cljdsTable'
            , loading: true
            , page: true //开启分页
            , where: {
                "lx": "2"
            }
            , contentType: 'application/json'
            , headers: {"authorization": token}
            , url: '/attention/attentionMgr/queryCfjdsTable' //数据接口
            , method: 'POST'
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
                }
            }
            , cols: [
                [
                    // {type: 'checkbox', fixed: 'left'},
                    {field: 'uuid', title: '金三案件信息表主键', width: 0, hide: true},
                    {field: 'jcajbh', title: '案件编号', width: 180, align: "center", sort: true},
                    {field: 'nsrsbh', title: '纳税人识别号', width: 180, align: "center", sort: true},
                    {field: 'nsrmc', title: '纳税人名称', width: 260, align: "center", sort: true},

                    {
                        field: 'wszzrq', title: '日期', width: 120, align: "center", sort: true, templet: function (d) {
                            if (!d.wszzrq) {
                                return '';
                            }
                            return layui.util.toDateString(d.wszzrq, 'yyyy-MM-dd');
                        }
                    },
                    {
                        field: 'xhrq',
                        title: '销号日期',
                        width: 120,
                        align: "center",
                        sort: true,
                        templet: function (d) {
                            if (!d.xhrq) {
                                return '';
                            }
                            return layui.util.toDateString(d.xhrq, 'yyyy-MM-dd');
                        }
                    },
                    {
                        field: 'sdrq',
                        title: '送达日期',
                        width: 120,
                        align: "center",
                        sort: true,
                        templet: function (d) {
                            if (!d.sdrq) {
                                return '';
                            }
                            return layui.util.toDateString(d.sdrq, 'yyyy-MM-dd');
                        }
                    },
                    {field: 'sdfs', title: '送达方式', width: 120, align: "center", sort: true},
                    {field: 'jcfwhnr', title: '稽查范围', width: 300, align: "center", sort: true},
                    {field: 'wfss', title: '违法事实', width: 300, align: "center", sort: true},
                    {field: 'yjfkje', title: '移交反馈金额', width: 160, align: "center", sort: true},
                    {field: 'wfsd', title: '违法所得', width: 220, align: "center", sort: true},
                    {field: 'cfjd', title: '处罚决定', width: 300, align: "center", sort: true},
                    {field: 'swxzcfyj', title: '处罚意见', width: 300, align: "center", sort: true},
                    {field: 'lrrDm', title: '录入人', width: 180, align: "center", sort: true},
                    {
                        field: 'lrrq',
                        title: '录入日期',
                        width: 120,
                        align: "center",
                        sort: true,
                        templet: function (d) {
                            if (!d.lrrq) {
                                return '';
                            }
                            return layui.util.toDateString(d.lrrq, 'yyyy-MM-dd');
                        }
                    },
                    {field: 'swjgDm', title: '税务机关名称', width: 220, align: "center", sort: true},
                ]
            ]
            , toolbar: '#toolbar1'
        });
        //日期
        laydate.render({
            elem: '#time'
            , type: 'date'
            , range: '~'
            , done: function (value) {
                if (value !== null && value !== undefined && value !== "") {
                    startTime = value.split("~")[0];
                    endTime = value.split("~")[1];
                } else {
                    startTime = null;
                    endTime = null;
                }
            }
        });
        //销号日期
        laydate.render({
            elem: '#xhTime'
            , type: 'date'
            , range: '~'
            , done: function (value) {
                if (value !== null && value !== undefined && value !== "") {
                    xh_startTime = value.split("~")[0];
                    xh_endTime = value.split("~")[1];
                } else {
                    xh_startTime = null;
                    xh_endTime = null;
                }
            }
        });

        //页面查询方法
        form.on('submit(search)', function (data) {
            let formData = data.field;
            console.log("formData:", formData)
            let whereParams = {
                "jcajbh": $("#jcajbh").val(),
                "nsrsbh": $("#nsrsbh").val(),
                "nsrmc": $("#nsrmc").val(),
                "startTime": startTime,
                "endTime": endTime,
                "xhStartTime": xh_startTime,
                "xhEndTime": xh_endTime,
                "sdztDm": $("#sdztDm").val(),
            };
            tableIns1.reload({
                contentType: 'application/json'
                , headers: {"authorization": token}
                , where: whereParams
                , method: 'POST'
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            }, false);
        })
        //页面查询条件重置按钮
        form.on('submit(reset)', function () {
            document.getElementById('searchForm').reset(); // 原生重置表单
            $('#time').val(''); // 清空输入框
            startTime = null; // 重置开始时间
            endTime = null; // 重置结束时间
            $('#xhTime').val(''); // 清空输入框
            xh_startTime = null;
            xh_endTime = null;
            form.render(); // 重新渲染 Layui 的动态组件
        })
    });
</script>
</body>
</html>